package roma.home.pages;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.Assert;

import roma.home.data.Values;

public class AbstractPage {
	
	protected WebDriver driver;
	
	public AbstractPage (WebDriver driver) {
		this.driver = driver;
	}
	
	public void clickTheLink(WebElement el) {
		el.click();
	}
	
	public void getBack() {
		driver.navigate().back();
	}
	
	public void loadHomePage() {
		driver.get(Values.HOME_URL);
		checkTitle(Values.HOME_TITLE);
	}
	
	public void checkTitle(String expText) {
		String actText = driver.getTitle();
		System.out.println(actText);
		Assert.assertEquals(actText, expText);
		}
	
	public void checkHeaders(WebElement el, String expText) {
		String actText = el.getText();
		System.out.println(actText);
		Assert.assertTrue(actText.contains(expText));
	}


}
